﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GPSCrowdSource.DataStructures {
  
  /// <summary>
  /// Provides a collection of radial sample elements which describe
  /// a significant change in average group size of a set of GPS points from
  /// one hour to another.
  /// </summary>
  public class HourToVolumeCollection : List<RadialSample> {

    #region Private
    private Object myMutex = new Object();
    #endregion

    #region Constructor
    public HourToVolumeCollection() { }
    public HourToVolumeCollection(ICollection<RadialSample> inC) : base(inC) {}
    #endregion

    #region Utility methods

    /// <summary>
    /// Ask if the distrubtuion contains a mapping from the given hour 'h1' to
    /// the given hour 'h2'.
    /// 
    /// Hours are provided by values of 0-23.
    /// </summary>
    public bool Contains(int h1, int h2) {

      lock(this) {
        for(int i=0;i<Count;i++) {
          RadialSample rs = this[i];
          if(rs.A.Hour == h1 && rs.B.Hour == h2)
            return true;
          }
        }

      return false;
      }

    #endregion
    }

  }
